package cn.ekuma.epos.datalogic;

import com.caucho.hessian.client.HessianProxyFactory;

import java.net.MalformedURLException;

import cn.ekuma.data.dao.I_DataLogic;

public class DataLogicPDA{
	
	public static I_DataLogicERP dlERP;
	public static I_DataLogicSales dlSales;
	public static I_DataLogic dataLogic;
	public static I_DataLogicReceipts dlReceipts;
	public static I_DataLogicSystem dlSystem;
	private static I_DataLogicPDA dlPDA;
	
	
		public static void init(String serviceAddr) throws MalformedURLException{
			 HessianProxyFactory factory=new HessianProxyFactory();
             System.setProperty("com.caucho.hessian.unsafe","false");

             dlERP = (I_DataLogicERP) factory.create(I_DataLogicERP.class, serviceAddr+"/DataLogicERP");
			 dlSales=(I_DataLogicSales) factory.create(I_DataLogicERP.class, serviceAddr+"/DataLogicSale");
			 dataLogic=(I_DataLogic) factory.create(I_DataLogic.class, serviceAddr+"/DataLogic");
			 dlReceipts=(I_DataLogicReceipts)factory.create(I_DataLogicReceipts.class, serviceAddr+"/DataLogicReceipt");
			 dlSystem=(I_DataLogicSystem)factory.create(I_DataLogicSystem.class, serviceAddr+"/DataLogicSystem");
			 dlPDA=(I_DataLogicPDA)factory.create(I_DataLogicPDA.class, serviceAddr+"/DataLogicPDA");


			 //FlamingoApplication flamingoApplication = (FlamingoApplication) getApplication();
            /**
			AndroidHessianProxyFactory factory2 = new AndroidHessianProxyFactory();
			AndroidServiceFactory factory=new AndroidServiceFactory(serviceAddr, factory1);

			 
			 dlERP = (I_DataLogicERP) factory.getService(I_DataLogicERP.class, "DataLogicERP");
			 dlSales=(I_DataLogicSales) factory.getService(I_DataLogicERP.class, "DataLogicSale");
			 dataLogic=(I_DataLogic) factory.getService(I_DataLogic.class, "DataLogic");
			 dlReceipts=(I_DataLogicReceipts)factory.getService(I_DataLogicReceipts.class, "DataLogicReceipt");
			 dlSystem=(I_DataLogicSystem)factory.getService(I_DataLogicSystem.class, "DataLogicSystem");
			 dlPDA=(I_DataLogicPDA)factory.getService(I_DataLogicPDA.class, "DataLogicPDA");
            **/
		}
	  
		public static I_DataLogicERP getDLERP(){
			return dlERP;
		}
		
		public static I_DataLogicSales getDLSales(){
			return dlSales;
		}
		
		public static I_DataLogic  getDataLogic(){
			return dataLogic;
		}
		
		public static I_DataLogicReceipts getDLReceipts(){
			return dlReceipts;
		}
		
		public static I_DataLogicSystem getDLSystem(){
			return dlSystem;
		}
		
		public static I_DataLogicPDA getDataLogicPDA(){
			return dlPDA;
		}
}
